package com.hu.zhcc.shiro.controller.dingming;


import com.alibaba.fastjson.JSON;
import com.hu.zhcc.common.entity.Page;
import com.hu.zhcc.shiro.entity.dingming.InterventionMiddleClass;
import com.hu.zhcc.shiro.service.dingming.InterventionMiddleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/intervention")
public class InterventionMiddleController {
    @Autowired
    private InterventionMiddleService interventionMiddleService;

    @GetMapping("")
    public ResponseEntity<Page<InterventionMiddleClass>> getOrderList(
            @RequestParam(required = false) String name,int offset, int limit) {
        System.out.println("name="+name+",offset="+offset+",limit="+limit);
        Map<String, Object> paremeters = new HashMap<String, Object>();
        paremeters.put("name", name);
        Page<InterventionMiddleClass> page = interventionMiddleService.listInterpose(paremeters, offset, limit);
        System.out.println(page.getRows());
        String s = JSON.toJSONString(page);
        System.out.println(s);
        return ResponseEntity.ok(page);
    }
}
